home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Arsenal Files 8
/
The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO
/
g_quake
/
server1.zip
/
_TELEFRG.QC
< prev
next >
Wrap
Text File
|
1996-08-30
|
2KB
|
88 lines
/*
**
** _telefrg.qc (Telefrag Code, 1.1)
**
** Copyright (C) 1996 Johannes Plass
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**
** Author: Johannes Plass (plass@dipmza.physik.uni-mainz.de)
**
*/
void(entity player) TelefragInfo =
{
if (!USE_MODULE_TELEFRAG) return;
// 123456789#123456789#123456789#12345678
sprint(player,"# Telefrag: Reduces risk of getting\n");
sprint(player," telefragged by respawning players.\n");
};
void(entity player) TelefragInit =
{
if (!USE_MODULE_TELEFRAG) return;
// nothing to do here
};
entity(entity spot) TelefragSelectSpawnPoint =
{
local entity e,firstspot;
local float search_spot;
if (!USE_MODULE_TELEFRAG) return(spot);
search_spot = 25;
firstspot = spot;
//dprint("TelefragSelectSpawnPoint: for ");//#jp#(debug)
//dprint(self.netname); dprint(":");//#jp#(debug)
while (search_spot) {
e = findradius(spot.origin, 100);
if (!e) {
search_spot = 0;
//dprint(" free");//#jp#(debug)
}
else {
local float occupied;
occupied = 0;
while (!occupied && !(!e)) {
if (e.classname == "player") {
if (e.deadflag == DEAD_NO) occupied = 1;
}
else e = e.chain;
}
if (occupied) {
//dprint(" blocked");//#jp#(debug)
spot = SelectSpawnPoint ();
search_spot = search_spot - 1;
if (spot == firstspot) {
//dprint("\nback to first spot, will stop search here");//#jp#(debug)
search_spot = 0;
}
} else {
//dprint(" not-blocked");//#jp#(debug)
search_spot = 0;
}
}
}
//dprint("\n");//#jp#(debug)
return(spot);
};